<template>
	<view>
		<navbar title="设置" :back="true"  color="#fff" leftIconColor="#fff"/>
<!-- 
		<view style="padding-left: 13rpx;padding-right: 25rpx;padding-top: 38rpx;padding-bottom: 38rpx;border-bottom: 1rpx solid rgba(112, 112, 112,.1);"
			class="u-flex u-row-left" >
			<view>
				<image :src="avatar" class="avatar" />
			</view>
			<view style="margin-left: 25rpx;line-height: 50rpx;width: 550rpx;">
				<view style="font-size: 29.17rpx;" class="u-line-1">{{nickname}}</view>
				<view style="font-size: 18.75rpx;">ID:{{uid}}</view>
			</view>
			<view>
				<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
			</view>
		</view> -->
        <view style="margin-top: 80rpx;padding: 0 30rpx;">
		    <view style="font-size: #666;font-size: 22rpx;">账号管理</view>
			<view class="u-flex u-row-between" style="padding: 20rpx 0;" @tap="goSelf()">
				<view class="font-1">个人信息</view>
				<view class="u-flex u-row-left">
					<image :src="avatar" class="avatar" style="margin-right: 20rpx;"/>
					<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
				</view>
			</view>
			<view class="u-flex u-row-between" @tap="goLogin()">
				<view>修改密码</view>
				<view>
					<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
				</view>
			</view>
		</view>
         <view style="padding: 0 30rpx;margin-top: 80rpx;">
			  <view style="font-size: #666;font-size: 22rpx;">其他操作</view>
			 <view class="u-flex u-row-between" @tap="goInfo('user_agreement')" style="padding: 20rpx 0;height: 100rpx;line-height: 100rpx;">
			 	<view>用户协议</view>
			 	<view>
			 		<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
			 	</view>
			 </view>
			 <view class="u-flex u-row-between" @tap="goInfo('privacy_agreement')">
			 	<view>隐私政策</view>
			 	<view>
			 		<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
			 	</view>
			 </view>
			 <view class="u-flex u-row-between" @tap="loginOut()" style="padding: 20rpx 0;height: 100rpx;line-height: 100rpx;">
			 	<view>退出登录</view>
			 	<view>
			 		<u-icon name="arrow-right" size="36rpx" color='#000'></u-icon>
			 	</view>
			 </view>
		 </view>
		<!-- <view style="line-height: 94rpx;margin-top: 30rpx;"> -->
			
			<!-- <view class="u-flex u-row-between line"  @tap="goInfo('law_agreement')">
				<view>法律声明</view>
				<view>
					<u-icon name="arrow-right" size="36rpx"></u-icon>
				</view>
			</view>
			<view class="u-flex u-row-between line"  @tap="goInfo('about_us')">
				<view>关于我们</view>
				<view>
					<u-icon name="arrow-right" size="36rpx"></u-icon>
				</view>
			</view> -->
			
			
	<!-- 	</view> -->
		<!-- 	<view style="margin-top:30rpx;padding:50rpx">
			<u-button type="success" @click="save()">保存修改</u-button>
		</view> -->
	</view>
</template>

<script>
	import navbar from '@/components/baseNavbar.vue'
	import {
		logout
	} from '@/api/user.js'
	export default {
		components: {
			navbar
		},
		data() {
			return {
				fileList: [],
				nickname: '',
				avatar: '',
				uid: ''
			}
		},
		onShow() {
			let that = this
			
			this.$store.dispatch("USERINFO", true).then((res) => {
				that.nickname = res.nickname
				that.avatar = res.avatar
				that.uid = res.uid
			});
		},
		methods: {
			goSelf() {
				uni.navigateTo({
					url: '/pages/sub/user/settingSelf'
				})
			},
			goLogin() {
				uni.navigateTo({
					url: '/pages/login/updataPad'
				})
			},
			loginOut() {
				logout().then(res => {
					this.$store.commit("LOGOUT");
					uni.switchTab({
						url: "/pages/index/index"
					})
				})
			},
			goInfo(name) {
				uni.navigateTo({
					url: "/pages/sub/user/settingInfo?name=" + name
				})
			},

		}
	}
</script>

<style lang="scss">
	page {
		background-color:#fff;
		color: #000;
	}
</style>
<style scoped lang="scss">
	.avatar {
		width: 80rpx;
		height: 80rpx;
		border: 4.17rpx solid #eee;
		border-radius: 50%;
	}

	.line {
		padding-left: 33rpx;
		border-bottom: 1rpx solid rgba(112, 112, 112,.1);
		padding-right: 28rpx;
	}
</style>
